<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>    
    <title>图片垂直居中 --次种方式是以兼容IE7模式的网页</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta http-equiv="x-ua-compatible" content="ie=7">

    <style type="text/css">
		</style>
	 
	</head>
  
  <body>
    <h1>图片垂直居中 --次种方式是以兼容IE7模式的网页 </h1>
    <h2>（新标准的网页可以使用,display:table-cell;vertical-align:middle;来实现垂直居中）</h2>
    <h2>&lt;meta http-equiv="x-ua-compatible" content="ie=7"&gt;</h2>
    <div style="height:200px;border:1px solid #000;">
    <div style="position:relative;background: green;width:100px;height:120px;">

        <div style="position:absolute;top:50%;">
          <img src="http://www.baidu.com/img/baidu_sylogo1.gif" style="position:relative;max-width:80px;max-height:100px;top:-50%;"/img>
        </div>
    </div>
   <div>
   
   <h3>日期：2012-10-10</h3>
  </body>
</html>
